<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ckplayer简单调用演示</title>
</head>
<title>解析</title>
<script src="https://cdn.bootcss.com/jquery/3.2.0/jquery.min.js"></script>
<script type="text/javascript" src="/ckplayer/ckplayer.js"></script>
</head>
<body>
	<div id="main">
		<input id="url" placeholder="视频地址">
		<button id="sub" onclick="get()">获取视频</button>
	</div>
	<div id="a1"></div>
	<input type="hidden" id="get" value="7F88C42258232C61CC8289EDF9662562">
	<!-- <div id="loading" align="center">
		<strong><br> <br> <br> <br> <br> <span
			class="tips">服务器正在解析中,请稍等....<font class="timemsg">0</font>s
		</span></strong><span class="timeout" style="display: none; color: #f90;">解析响应超时，请刷新重试！</span>
	</div> -->
	<div id="a1" style="display: none;"></div>
	<div id="error" align="center" style="display: none; color: #f90;">
		<br> <br> <br> <br> <br>视频解析失败/URL错误，请点击<a
			href="javascript:location.reload();">重试</a>...
	</div>
</body>
<script type="text/javascript">
	function get() {
		var url = $("#url").val();
		//请求视频地址
		$.post("/get", {
			"videoUrl" : url
		}, function(data) {
			//得到key进行异步请求获取视频信息
			play(data);
		}, "json");
	}
	var ptiqy = 0;
	var errid = 0;
	//var isiPad = navigator.userAgent.match(/iPad|iPhone|Linux|Android|iPod/i) != null;
	function play(vkey) {
		$.post("/play",
						{
							"vkey" : vkey
						},
						function(data) {
							if (data.success == 1) {
								if (data.play == 'html5') {
									$('#a1').html('<video id="vod" src="'
															+ data.url
															+ '" controls="controls" autoplay="autoplay" poster="/ckplayer/loading_wap.gif" width="100%" height="100%"></video>');
									isiPad = true;
									//setInterval('error()',1000);
								} else {
									//var flashvars;
									if (data.play == 'm3u8'
											|| data.play == 'm3u8_list') {
										var flashvars = {
											f : '/ckplayer/m3u8/m3u8.swf',
											a : data['url'],
											c : 0,
											p : 1,
											s : 4,
											v : 100,
											lv : 0
										};
									} else if (data.play == 'mp4') {
										var flashvars = {
											f : data.url,
											c : 0,
											p : 1,
											v : 100,
											h : 1
										};
									} else if (data.play == 'xml') {
										var flashvars = {
											f : data.url,
											c : 0,
											s : 2,
											h : 4,
											p : 1,
											v : 100,
											e : 1
										};
									} else if (data.play == 'm3u8_q') {
										var flashvars = {
											f : data.url,
											c : 0,
											s : 2,
											h : 3,
											p : 1,
											e : 0
										};
									}
									 var params={bgcolor:'#FFF',allowFullScreen:true,allowScriptAccess:'always',wmode:'transparent'};
								     CKobject.embedSWF('/ckplayer/ckplayer.swf','a1','ckplayer_a1','600','600',flashvars,params);
								}
								
								
							} else {
								//出现错误
							}
						}, "json");
	}
</script>
<style>
#main {
	
}
</style>

</html>